<?php defined("_JEXEC") or die("Acesso Restrito"); 
JHTML::_("behavior.modal");
?>

<script type="text/javascript">
	jQuery(function($){
		$("#termino").mask("99/9999");
	});
</script>
<form name="formCursos" action="index.php?option=com_sgrh" method="post">
	<div class="titulosPagina">Cadastre-se</div>
	<div class="subTitulos">(* Campos Obrigatórios)</div>
	<fieldset>
		<legend>Cursos Extra-Curriculares</legend>
		<div class="botaoFinalPagina">
			<?php if($this->botao == 2){ ?>
			<div style="float:left" >
				<a class="modal" href="index2.php?option=com_sgrh&view=gerenciador&controller=gerenciador&task=buscarContatos&idPessoa=<?php echo $row->id ?>">
					<img alt="" src="components/com_sgrh/auxiliares/imagens/telephone32.png" />
				</a>
			</div>
			<?php } ?>
			<button name="task" value="addCurso" class="botao" onclick="submitform('addCurso')" >
				<div class="iconesForm" >
					<img alt="" src="components/com_sgrh/auxiliares/imagens/btnNovo.png" />
				</div>
				<div class="tituloBotoes">Adicionar</div>
			</button>
		</div>
		<div class="campo">
			<div class="for_label">Instituição:</div>
			<input class="inputbox" type="text" name="instituicao" id="instituicao"/>
		</div>
		<div class="clr"></div>
		<div class="campo">
			<div class="for_label">Curso:</div>
			<input class="inputbox" type="text" name="curso" id="curso"/>
		</div>
		<div class="clr"></div>
		<div class="campo">
			<div class="for_label">Carga Horária:</div>
			<input class="inputbox_menor" type="text" name="cargaHoraria" id="cargaHoraria"/>  (em horas)
		</div>
		<div class="clr"></div>
		<div class="campo">
			<div class="for_label">Término:</div>
			<input class="inputbox_menor" type="text" name="termino" id="termino"/> (mm/aaaa)
		</div>

		<!-- Tabela de Cursos -->
		<div id="editcell">
			<table class="lista">
				<thead>
					<tr>
						<th width="25%">
							<?php echo JText::_('Instituição'); ?>
						</th>
						<th width="25%">
							<?php echo JText::_('Curso'); ?>
						</th>
						<th width="15%">
							<?php echo JText::_('Carga Horária'); ?>
						</th>
						<th width="20%">
							<?php echo JText::_('Término'); ?>
						</th>
						<th width="%7">
							<?php echo JText::_('Remover'); ?>
						</th>
					</tr>
				</thead>

				<?php
				for ($i = 0; $i < count($this->registro); $i++) {
					$obj = & $this->registro[$i];
					if($this->botao == 2)
						$link = JRoute::_("index.php?option=com_sgrh&controller=candidato&task=apagarCurso&id={$obj->id}&idPessoa={$obj->idPessoa}&botao=2");
					else
						$link = JRoute::_("index.php?option=com_sgrh&controller=candidato&task=apagarCurso&id={$obj->id}&idPessoa={$obj->idPessoa}");
					?>
					<tr class="<?php echo "row" . ($i % 2); ?>">
						<td>
							<?php echo $obj->instituicao; ?>
						</td>
						<td>
							<?php echo $obj->curso; ?>
						</td>
						<td>
							<?php echo $obj->cargaHoraria; ?>
						</td>
						<td>
							<?php echo $obj->termino; ?>
						</td>
						<td width="4%">
							<a href="<?php echo $link ?>">
								<img alt="" src="components/com_sgrh/auxiliares/imagens/btnRemover.png" />
							</a>
						</td>
					</tr>
						<?php
					}
					?>
			</table>
		</div>
	</fieldset>
	<input type="hidden" name="view" value="candidato" />
	<input type="hidden" name="botao" value="<?php echo $this->botao ?>" />
	<input type="hidden" name="idPessoa" value="<?php echo $this->idPessoa ?>" />
	<input type="hidden" name="controller" value="candidato" />
	<?php echo JHTML::_('form.token'); ?> 
</form>

<form name="formIdioma" action="index.php?option=com_sgrh" method="post">
	<fieldset>
		<legend>Idiomas</legend>
		<div class="botaoFinalPagina">
			<button name="task" value="addIdioma" class="botao" onclick="submitform()" >
				<div class="iconesForm" >
					<img alt="" src="components/com_sgrh/auxiliares/imagens/btnNovo.png" />
				</div>
				<div class="tituloBotoes">Adicionar</div>
			</button>
		</div>
		<div class="campo">
			<div class="for_label">Idioma:</div>
			<input class="inputbox" type="text" name="idioma" id="idioma"/>
		</div>
		<div class="clr"></div>
		<div class="campo">
			<div class="for_label">Nível:</div>
			<?php echo $this->niveisIdioma ?>
		</div>
		<div class="clr"></div>
		<!-- Tabela de Idiomas -->
		<div id="editcell">
			<table class="lista">
				<thead>
					<tr>
						<th width="25%">
							<?php echo JText::_('Idioma'); ?>
						</th>
						<th width="25%">
							<?php echo JText::_('Nível'); ?>
						</th>
						<th width="7%">
							<?php echo JText::_('Remover'); ?>
						</th>
					</tr>
				</thead>

				<?php
				for ($i = 0; $i < count($this->registroIdioma); $i++) {
					$obj = & $this->registroIdioma[$i];
					if($this->botao == 2)
						$link = JRoute::_("index.php?option=com_sgrh&controller=candidato&task=apagarIdioma&id={$obj->id}&idPessoa={$obj->idPessoa}&botao=2");
					else
						$link = JRoute::_("index.php?option=com_sgrh&controller=candidato&task=apagarIdioma&id={$obj->id}&idPessoa={$obj->idPessoa}");
				?>
					<tr class="<?php echo "row" . ($i % 2); ?>">
						<td>
							<?php echo $obj->descricao; ?>
						</td>
						<td>
							<?php
							switch ($obj->nivel) {
								case 1:
									echo 'Básico';
									break;
								case 2:
									echo 'Intermediário';
									break;
								case 3:
									echo 'Avançado';
									break;
								default:
									echo 'Error';
									break;
							}
							?>

						</td>
						<td width="4%">
							<a href="<?php echo $link ?>">
								<img alt="" src="components/com_sgrh/auxiliares/imagens/btnRemover.png" />
							</a>
						</td>
					</tr>
				<?php
				}
				?>
			</table>
		</div>
	</fieldset>
	<input type="hidden" name="view" value="candidato" />
	<input type="hidden" name="idPessoa" value="<?php echo $this->idPessoa ?>" />
	<input type="hidden" name="controller" value="candidato" />
	<input type="hidden" name="botao" value="<?php echo $this->botao ?>" />
	<?php echo JHTML::_('form.token'); ?> <!-- Aumenta a segurança -->
</form>

<form name="formInformatica" action="index.php?option=com_sgrh" method="post">
	<fieldset>
		<legend>Informática</legend>
		<div class="botaoFinalPagina">
			<button name="task" value="addInformatica" class="botao" onclick="submitform()" >
				<div class="iconesForm" >
					<img alt="" src="components/com_sgrh/auxiliares/imagens/btnNovo.png" />
				</div>
				<div class="tituloBotoes">Adicionar</div>
			</button>
		</div>
		<div class="campo">
			<div class="for_label">Item:</div>
			<input class="inputbox" type="text" name="descricao" id="descricao"/>
		</div>
		<div class="clr"></div>
		<div class="campo">
			<div class="for_label">Nível:</div>
			<?php echo $this->niveisInformatica ?>
		</div>
		<div class="clr"></div>
		<!-- Tabela de Idiomas -->
		<div id="editcell">
			<table class="lista">
				<thead>
					<tr>
						<th width="25%">
							<?php echo JText::_('descricao'); ?>
						</th>
						<th width="25%">
							<?php echo JText::_('Nível'); ?>
						</th>
						<th width="7%">
							<?php echo JText::_('Remover'); ?>
						</th>
					</tr>
				</thead>

				<?php
				for ($i = 0; $i < count($this->registroInformatica); $i++) {
					$obj = & $this->registroInformatica[$i];
					if($this->botao == 2)
						$link = JRoute::_("index.php?option=com_sgrh&controller=candidato&task=apagarInformatica&id={$obj->id}&idPessoa={$obj->idPessoa}&botao=2");
					else
						$link = JRoute::_("index.php?option=com_sgrh&controller=candidato&task=apagarInformatica&id={$obj->id}&idPessoa={$obj->idPessoa}");
				?>
					<tr class="<?php echo "row" . ($i % 2); ?>">
						<td>
							<?php echo $obj->descricao; ?>
						</td>
						<td>
							<?php
							switch ($obj->nivel) {
								case 1:
									echo 'Básico';
									break;
								case 2:
									echo 'Intermediário';
									break;
								case 3:
									echo 'Avançado';
									break;
								default:
									echo 'Error';
									break;
							}
							?>
						</td>
						<td width="4%">
							<a href="<?php echo $link ?>">
								<img alt="" src="components/com_sgrh/auxiliares/imagens/btnRemover.png" />
							</a>
						</td>
					</tr>
					<?php
					}
					?>
			</table>
		</div>
	</fieldset>
	<input type="hidden" name="view" value="candidato" />
	<input type="hidden" name="idPessoa" value="<?php echo $this->idPessoa ?>" />
	<input type="hidden" name="controller" value="candidato" />
	<input type="hidden" name="botao" value="<?php echo $this->botao ?>" />
	<?php echo JHTML::_('form.token'); ?> <!-- Aumenta a segurança -->
</form>
<form action="index.php?option=com_sgrh" name="formBotoes" method="post" >
	<!-- BOTÕES DO FINAL DA PAGINA -->
	<?php
	if ($this->botao == null && $idPessoa == null ) {
		?>
		<div class="botaoFinalPagina">
			<button name="task" value="salvarCursos" class="botao" onclick="submitform()" >
				<div class="iconeProximo" >
					<img alt="" src="components/com_sgrh/auxiliares/imagens/next.png" />
				</div>
				<div class="proximo">
					Próxima Etapa
				</div>
			</button>
		</div>
		<div class="botaoFinalPagina">
			<button name="task" value="voltarDados" class="botao" onclick="submitform()" >
				<div class="iconeProximo" >
					<img alt="" src="components/com_sgrh/auxiliares/imagens/back.png">
				</div>
				<div class="proximo">
					Etapa Anterior
				</div>
			</button>
		</div>
		<?php
	}
	?>
	<?php
	if ($this->botao == 2) {
		?>
		<div class="botaoFinalPagina">
			<button name="task" value="salvarAlteracao" class="botao" onclick="submitform('')" >
				<div class="iconeProximo" >
					<img alt="" src="components/com_sgrh/auxiliares/imagens/accept.png" />
				</div>
				<div class="proximo">
					Salvar e Voltar
				</div>
			</button>
		</div>
		<?php
	}
	?>

	<div class="clr"></div>
	<input type="hidden" name="view" value="candidato" />
	<input type="hidden" name="tplAnterior" value="escolaridade" />
	<input type="hidden" name="tplAtual" value="curso" />
	<input type="hidden" name="botao" value="<?php echo $this->botao ?>" />
	<input type="hidden" name="idPessoa" value="<?php echo $this->idPessoa ?>" />
	<input type="hidden" name="controller" value="candidato" />
	<?php echo JHTML::_('form.token'); ?>
</form>